.. _syntax-error,-unexpected-token-")",-expecting-variable:
syntax error, unexpected token ")", expecting variable
------------------------------------------------------
.. meta::
:description:
syntax error, unexpected token ")", expecting variable: An attribute placed inside a parameter list must be immediately followed by the parameter it decorates.
:og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png
:og:type: article
:og:title: syntax error, unexpected token ")", expecting variable
:og:description: An attribute placed inside a parameter list must be immediately followed by the parameter it decorates
:og:url: https://php-errors.readthedocs.io/en/latest/messages/syntax-error%2C-unexpected-token-%22%29%22%2C-expecting-variable.html
:og:locale: en
:twitter:card: summary_large_image
:twitter:site: @exakat
:twitter:title: syntax error, unexpected token ")", expecting variable
:twitter:description: syntax error, unexpected token ")", expecting variable: An attribute placed inside a parameter list must be immediately followed by the parameter it decorates
:twitter:creator: @exakat
:twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png
.. raw:: html
Description
___________
An attribute placed inside a parameter list must be immediately followed by the parameter it decorates. Here, the attribute is the last thing before the closing parenthesis, so PHP expects a variable to declare the parameter, but finds the closing parenthesis instead.
Example
_______
.. code-block:: php
Solutions
_________
+ Add the missing parameter, with its ``$`` variable, right after the attribute.
+ Remove the trailing attribute if no extra parameter was intended.
Related Error Messages
______________________
+ :ref:`syntax-error,-unexpected-token-"#[",-expecting-")"`
+ :ref:`syntax-error,-unexpected-token-"{",-expecting-variable`
+ :ref:`syntax-error,-unexpected-variable-"$%s",-expecting-")"`
+ :ref:`syntax-error,-unexpected-variable-"$task",-expecting-")"`
See Also
________
+ `Attributes `_
Changed Behavior
________________
This error may appear following an evolution in behavior, in previous versions. See ` `_.